<?php
namespace app\user\validate\teacher\admin;

use think\Validate;

/**
 * 用户验证
 */
class Teacher extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id'               => 'require',
        'fullcategorypath' => 'require',
        'level_id'         => 'require|gt:0',
        'user_phone'       => 'require|mobile',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [
        'id'               => '操作出错',
        'fullcategorypath' => '请选择分类',
        'level_id'         => '请选择等级',
        'user_phone'       => '请填写正确的机构管理员手机号',

    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'create' => ['fullcategorypath', 'level_id', 'user_phone'],
        'edit'   => ['id', 'fullcategorypath', 'level_id'],
    ];

}
